package re_0905.question_queue;

public class Main {
    public static void main(String[] args) {
        MoterQueueImpl<Integer> queue = new MoterQueueImpl<>(40);
        for (int i = 0; i < 10; i++) {
            final int finalI =i;
            new Thread(()->{
                for (int i1 = 0; i1 < 3; i1++) {
                    queue.add(finalI);
                }
            }).start();
        }
        while(Thread.activeCount()>2){}
        MoterIterator<Integer> iterator = queue.iterator();
        while(iterator.hasNext()){
            Integer next = iterator.next();
            if(next==3||next==1)
                iterator.remove();
            System.out.print(next+"\t");
        }
        queue.forEach(System.out::print);
    }
}
